<template>
	<view class="content">
		<view class="title">
			服务商登录
		</view>
		<view class="form">
			<view class="form-item">
				<view class="form-lable">
					登录账号
				</view>
				<view class="form-content">
					<image style="width: 34rpx;height: 45rpx;" src="https://s1.ax1x.com/2022/11/18/znu2KU.png" mode=""></image>
					<input v-model="mobile" type="text" placeholder="请输入登录账号">
				</view>
			</view>
			<view class="form-item">
				<view class="form-lable">
					账号密码
				</view>
				<view class="form-content">
					<image style="width: 31rpx;height: 40rpx;" src="https://s1.ax1x.com/2022/11/18/znucvT.png" mode=""></image>
					<input v-model="password" type="password" placeholder="请输入登录密码">
				</view>
			</view>
		</view>
		<button class="u-reset-button btn-moren" @click="logo">立即登录</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				mobile:'', // 13100000001
				password:'' // 123456
			}
		},
		methods: {
			// 服务商登录
			logo(){
				this.$u.post('user/service_login',{
					openid:uni.getStorageSync('openid'),
					mobile:this.mobile,
					password:this.password
				}).then(res =>{
					uni.showToast({
						icon:'success',
						title:'登录成功'
					})
					uni.setStorageSync('servInfo',JSON.stringify(res.data))
					uni.setStorageSync('servToken',res.data.token)
					setTimeout(()=>{
						uni.switchTab({
							url:'../service/index/index'
						})
					},800)
					
				}).catch(res =>{
					// console.log(res.data.msg)
					uni.showToast({
						icon:'error',
						title:res.data.msg
					})
				})
			},
		}
	}
</script>

<style lang="less">
page{
		background: rgba(230, 251, 255, 0.16);
		background-size: 100% 100%;
	}
	
	.title{
		font-size: 48rpx;
		color: #234D7F;
		font-weight: bold;
		display: flex;
		align-items: center;
		justify-content: center;
		position: relative;
		margin-bottom: 124rpx;
		padding-top: 35rpx;
		&::after{
			content: "";
			width: 60rpx;
			height: 4rpx;
			border-radius: 2rpx;
			background: #234D7F;
			position: absolute;
			bottom: -18rpx;
		}
	}
	.form{
		padding: 0 35rpx;
	}
	.form-item{
		margin-bottom: 81rpx;
	}
	.form-content{
		display: flex;
		align-items: center;
		height: 100rpx;
		padding: 0 21rpx;
		border-radius: 10rpx;
		box-shadow: 0px 2px 18px 0px rgba(0,0,0,0.12);
		image{
			flex-shrink: 0;
			margin-right: 50rpx;
		}
		input{
			font-size: 28rpx;
		}
	}
	.form-lable{
		font-size: 38rpx;
		margin-bottom: 20rpx;
		font-weight: 500;
	}
	.btn-moren{
		width: 650rpx;
		height: 130rpx;
		font-size: 50rpx;
		margin-top: 200rpx;
	}
</style>
